/**
 * uniapp页面路由跳转
 * goUrl(普通页面跳转)，goTab(跳转tab页)，goRedirect(关闭当前页面跳转)，goRelaunch(关闭所有页面跳转)，goBack(返回上一页)
 */


function goUrl(url, options) {
	uni.navigateTo({
		url: url,
		...options,
	});
}

function goTab(url, options) {
	uni.switchTab({
		url: url,
		...options,
	});
}

function goRedirect(url, options) {
	uni.redirectTo({
		url: url,
		...options,
	});
}

function goRelaunch(url, options) {
	uni.reLaunch({
		url: url,
		...options,
	});
}

function goBack(delta = 1, options) {
	uni.navigateBack({
		delta: delta,
		...options,
	});
}

export default {
	goUrl,
	goTab,
	goRedirect,
	goRelaunch,
	goBack,
};
